'''
Created on 2014-4-21

@author: shen
'''

import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
from numpy.lib.function_base import average
from test.test_iterlen import len

class Get_Price_List:

    # the format of list:ASIN,price,seller,time(XXXX-XX-XX XX:XX:XX)
    # see also the 'draw_price_chart_example'
    def get_infolist(self):
        file_object = open(file_name() , 'r');
        ASIN_info = ''
        other_info={}
        list = []
    
        for line in file_object:
            splitInfo = line.split('    ' )
            if len(splitInfo)==1:
                ASIN_info = splitInfo[0]
            else:
                list.append({'ASIN':ASIN_info,'price':float(splitInfo[1]),'seller':splitInfo[2],'time':splitInfo[3]})
                ASIN_info=''
                
        return list

def file_name():
        return '../txt_package/phone_price.txt'    
    
        